<?php

namespace app\common\model;

use think\Model;
use Data;
use think\Cache;

class Authrule extends Model
{
    /*获取规则 （按级别）*/
    public static function getRuleLevel()
    {
        $ruleDatas = self::all();
        $ruleDatas = Data::channelLevel($ruleDatas, $pid = 0, $html = "&nbsp;", $fieldPri = 'id', $fieldPid = 'pid', $level = 1);
        return $ruleDatas;
    }

    /*获取规则 （树形）*/
    public static function getRuleTree()
    {
        $ruleDatas = self::all();
        $ruleDatas = Data::tree($ruleDatas, $title = 'title', $fieldPri = 'id', $fieldPid = 'pid');
        return $ruleDatas;
    }

}
